load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")

cc_library(
    name = "unit_test",
    hdrs = ["unit_test.hpp"],
)

_TESTS = {
    "any_completion_executor": [],
    "any_completion_handler": [],
    "any_io_executor": [],
    "append": [],
    "as_tuple": [],
    "associated_allocator": [],
    "associated_cancellation_slot": [],
    "associated_executor": [],
    "associated_immediate_executor": [],
    "associator": [],
    "async_result": [],
    "awaitable": [],
    "basic_datagram_socket": [],
    "basic_deadline_timer": [],
    "basic_file": [],
    "basic_random_access_file": [],
    "basic_raw_socket": [],
    "basic_readable_pipe": [],
    "basic_seq_packet_socket": [],
    "basic_serial_port": [],
    "basic_signal_set": [],
    "basic_socket": [],
    "basic_socket_acceptor": [],
    "basic_stream_file": [],
    "basic_stream_socket": [],
    "basic_streambuf": [],
    "basic_waitable_timer": [],
    "basic_writable_pipe": [],
    "bind_allocator": [],
    "bind_cancellation_slot": [],
    "bind_executor": [],
    "bind_immediate_executor": [],
    "buffer": [],
    "buffer_registration": [],
    "buffered_read_stream": [
        "//archetypes:async_result",
    ],
    "buffered_stream": [
        "//archetypes:async_result",
    ],
    "buffered_write_stream": [
        "//archetypes:async_result",
    ],
    "buffers_iterator": [],
    "cancellation_signal": [],
    "cancellation_state": [],
    "cancellation_type": [],
    "co_spawn": [],
    "completion_condition": [],
    "compose": [],
    "connect": [],
    "connect_pipe": [],
    "consign": [],
    "coroutine": [],
    "deadline_timer": [
        "//archetypes:async_result",
    ],
    "defer": [],
    "deferred": [],
    "detached": [],
    "dispatch": [],
    "error": [],
    "execution_context": [],
    "executor": [],
    "executor_work_guard": [],
    "file_base": [],
    "high_resolution_timer": [],
    "io_context": [],
    "io_context_strand": [],
    "is_read_buffered": [],
    "is_write_buffered": [],
    "packaged_task": [],
    "placeholders": [],
    "post": [],
    "prepend": [],
    "random_access_file": [
        "//archetypes:async_result",
    ],
    "read": [
        "//archetypes:async_result",
    ],
    "read_at": [
        "//archetypes:async_result",
    ],
    "read_until": [
        "//archetypes:async_result",
    ],
    "readable_pipe": [
        "//archetypes:async_result",
    ],
    "recycling_allocator": [],
    "redirect_error": [],
    "registered_buffer": [],
    "serial_port": [
        "//archetypes:async_result",
    ],
    "serial_port_base": [],
    "signal_set": [
        "//archetypes:async_result",
    ],
    "signal_set_base": [],
    "socket_base": [],
    "static_thread_pool": [],
    "steady_timer": [],
    "strand": [],
    "stream_file": [
        "//archetypes:async_result",
    ],
    "streambuf": [],
    "system_context": [],
    "system_executor": [],
    "system_timer": [],
    "this_coro": [],
    "thread_pool": [],
    "time_traits": [],
    "use_awaitable": [],
    "use_future": [
        "//archetypes:async_ops",
    ],
    "uses_executor": [],
    "wait_traits": [],
    "writable_pipe": [
        "//archetypes:async_result",
    ],
    "write": [
        "//archetypes:async_result",
    ],
    "write_at": [
        "//archetypes:async_result",
    ],
}

[cc_test(
    name = test,
    srcs = ["{}.cpp".format(test)],
    deps = [
        ":unit_test",
        "@boost.asio",
    ] + _TESTS[test],
) for test in _TESTS]
